Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(community): add mmr search to pgvector #7438

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

anadi45
Copy link
Contributor

@anadi45 anadi45 commented Dec 27, 2024

Adds new features to pgvector class

  1. Add flag to include vectors in similarity search
  2. maxMarginalRelevanceSearch implementation

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Dec 27, 2024
Copy link

vercel bot commented Dec 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-docs ✅ Ready (Inspect) Visit Preview Dec 31, 2024 6:10pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ⬜️ Ignored (Inspect) Dec 31, 2024 6:10pm

@anadi45
Copy link
Contributor Author

anadi45 commented Dec 28, 2024

@jacoblee93 Please take a look when possible.

* @returns Promise that resolves with an array of tuples, each containing a `Document` and its similarity score.
*/
async similaritySearchVectorWithScore(
query: number[],
k: number,
filter?: this["FilterType"]
filter?: this["FilterType"],
includeEmbedding?: boolean
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the default signature (even adding params) makes migrations a lot trickier - can we factor this out into a private method?

Sort of like we did with Supabase:

https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-community/src/vectorstores/supabase.ts#L280

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jacoblee93 thanks for the review. Have made the suggested changes.

Copy link
Collaborator

@jacoblee93 jacoblee93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! One small comment but mostly looks good

@jacoblee93 jacoblee93 added the close PRs that need one or two touch-ups to be ready label Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
close PRs that need one or two touch-ups to be ready size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants